/**
 * 合作加盟  业务逻辑实现类
 * @author WangXinLei
 * @date 2014-12-09
 */
package com.chnbst.bstyun.service.impl;

import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.chnbst.bstyun.core.base.BaseService;
import com.chnbst.bstyun.core.common.helper.DaoHelper;
import com.chnbst.bstyun.model.pojo.Partner;
import com.chnbst.bstyun.service.PartnerService;

@Transactional
@Service
public class PartnerServiceImpl extends BaseService implements PartnerService{

	//声明日志对象 logback
	private final static Logger logger = LoggerFactory.getLogger(PartnerServiceImpl.class);
	private final static String nameSpace = "com.chnbst.bstyun.mapper.PartnerMapper";
	
	@Transactional(propagation=Propagation.REQUIRED,readOnly=true)
	@Override
	public Partner selectByPartnerId(Integer partnerId) {
		return (Partner) DaoHelper.query(nameSpace, "selectByPartnerId", partnerId);
	}
	
	@SuppressWarnings("unchecked")
	@Transactional(propagation=Propagation.REQUIRED,readOnly=true)
	@Override
	public List<Partner> selectAllPartners() {
		return (List<Partner>) DaoHelper.list(nameSpace, "selectAllPartners", null);
	}
	
	@Transactional(propagation=Propagation.REQUIRED,readOnly=false)
	@Override
	public boolean deleteByPartnerId(Integer partnerId) {
		return DaoHelper.delete(nameSpace, "deleteByPartnerId", partnerId);
	}
	
	@Transactional(propagation=Propagation.REQUIRED,readOnly=false)
	@Override
	public boolean insertPartner(Partner partner) {
		return DaoHelper.insert(nameSpace, "insertPartner", partner);
	}
	
	@Transactional(propagation=Propagation.REQUIRED,readOnly=false)
	@Override
	public boolean updateByPartnerId(Partner partner) {
		return DaoHelper.update(nameSpace, "updateByPartnerId", partner);
	}
	
}
